package tables

import (
	"fmt"
	"peilian-api/app/global/variable"
)

type CustomLabel struct {
	Model
	JobName string `gorm:"type:varchar(100);index;comment:职位的名称" json:"job_name"`
	Content string `gorm:"type:text;comment:返回的标签信息" json:"content"`
	TaskId  string `gorm:"type:varchar(36);comment:处理任务时的id" json:"task_id"`
	Status  int    `gorm:"type:tinyint(4);default:1;comment:状态信息 1: 初始化 2: 创建生成任务 3: 返回标签信息 4: 添加完成"`
}

func (s *CustomLabel) TableName() string {
	return "custom_label"
}

func (s *CustomLabel) GetLabelByName(name string) (out *CustomLabel) {
	variable.DB.MySQL.Model(&s).Where("job_name = ?", name).First(&out)
	fmt.Println(out)
	return out
}
